package com.example.trans.controller;


import com.example.trans.service.LogService;
import com.example.trans.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@Slf4j
@RequestMapping("/proga")
@RestController
public class PropagationController {
    @Autowired
    private UserService userService;

    @Autowired
    private LogService logService;
    //设置事务的隔离级别
    @Transactional
    @RequestMapping("/p1")
    public String r8(String name, String password) throws IOException {
        //用户注册
userService.registryUser(name, password);
logService.insertLog(name, "用户注册");

        return "注册成功";
    }
}
